const { Sequelize } = require("sequelize");
const initModules = require("../models/init-models.js");

const sequelize = new Sequelize("test", "root", "123456", {
  host: "43.143.28.65",
  dialect: "mysql",
  port: 3307,
});

(async function () {
  try {
    await sequelize.authenticate();
    console.log("数据库链接成功");
  } catch (error) {
    console.error("数据库链接失败:", error);
  }
})();

const modules = initModules(sequelize);

module.exports = {sequelize, ...modules}
